//
//  LTView.m
//  UI09_作业
//
//  Created by dllo on 16/6/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LTView.h"

@implementation LTView

- (instancetype)initWithFrame:(CGRect)frame Text:(NSString *)text
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
        self.label.text = text;
    }
    return self;
}
- (void)createSubView{
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 80, 30)];
    [self addSubview:_label];
    [_label release];
    
    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(self.label.frame.origin.x + self.label.frame.size.width + 5, 0, 200, 30)];
    textField.delegate = self;
    textField.layer.borderWidth = 1;
    textField.layer.cornerRadius = 5;
//    textField.backgroundColor = [UIColor grayColor];
    [self addSubview:textField];
    [textField release];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
 return [textField resignFirstResponder];

}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self endEditing:YES];
}

@end
